   <#include "../inc.html"/>
    <script type="text/javascript">
    var tt = 0;
    $(function(){
    	sy.ns('sy.admin.menu${(OP.TMenu.id)!}');
    	
    	$('#admin_menu${(OP.TMenu.id)!}_datagrid').treegrid(  {
    			  expanderExpandedClass: 'glyphicon glyphicon-minus',
                expanderCollapsedClass: 'glyphicon glyphicon-plus'
    	}  );
    	
    	 
    })
    

//新增
sy.admin.menu${(OP.TMenu.id)!}.add = function(){
	sy.showWindow({
			title:'增加菜单',
			href:'op_add_${(OP.TMenu.id)!}.action',
			width:'800px',
			height:'600px',
			okhandler:function(){
				sy.admin.menu${(OP.TMenu.id)!}.save();
			},
			cancelhandler:function(){
				sy.closeWindow();
			}
		});
}

	//编辑
sy.admin.menu${(OP.TMenu.id)!}.edit = function(){
	 var $idsCheckedCheck = $("#admin_menu${(OP.TMenu.id)!}_datagrid input[name='ids']:checked");
		if ($idsCheckedCheck.size() > 1) {
			 sy.toastrsAlert({
			     code:'warning',
			     msg:'sorry , 只能选择一条进行编辑'
			});
			return false;
		}
		if($idsCheckedCheck.size() == 0){
			sy.toastrsAlert({
			     code:'info',
			     msg:'请选择你要编辑的记录'
			});
			return false;
		}
	sy.showWindow({
			title:'编辑菜单',
			href:'op_edit_${(OP.TMenu.id)!}.action?id='+$idsCheckedCheck.val(),
			width:'800px',
			height:'600px',
			okhandler:function(){
				sy.admin.menu${(OP.TMenu.id)!}.save();
			},
			cancelhandler:function(){
				sy.closeWindow();
			}
		});
}
 
	
	//删除
	sy.admin.menu${(OP.TMenu.id)!}.remove = function(){
		var rows =$('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable('getSelections');
		 var $idsCheckedCheck = $("#admin_menu${(OP.TMenu.id)!}_datagrid input[name='ids']:checked");
	if($idsCheckedCheck.length==0){
		 sy.toastrsAlert({
		     code:'info',
		     msg:'请选择你要删除的记录'
		});
		return;
	}
	
	sy.confirm(function(){
		var ps = [];
		$.each($idsCheckedCheck,function(i,n){
    		ps.push($(n).val());
    	});
    	$.ajax({
            type: 'post',
            url: 'op_remove_${(OP.TMenu.id)!}.action',
            data: {"ids":ps.join(",")},
            dataType: 'json',
            success: function (data) {
            	//$('#admin_menu${(OP.TMenu.id)!}_datagrid').bootstrapTable('refresh');
            	sy.reloadDiv('op_list_${(OP.TMenu.id)!}.action');
            	sy.toastrsAlert({
       		     code:'success',
       		     msg:'删除成功'
       		});
            }
        });
	});
	 
	}
    

    </script>
       <div class="wrapper wrapper-content gray-bg animated  ${(cfg.animated)!}   "   style="height:100%">
                <div class="ibox">
                    <div class="ibox-content" style="padding-bottom: 50px;">
                                <#include "../toolbar.html"/>
                              <form action="op_list_${(OP.TMenu.id)!}.action" method="get">
                                <table  id="admin_menu${(OP.TMenu.id)!}_datagrid"    class="table table table-striped table-bordered table-hover  table table-striped">
                                  <thead>
                                    <tr>
                                        <th><input type="checkbox"  onclick="$('.i-checkss').prop('checked',($(this).prop('checked') ? true : false ))"   class="i-checkssz" name="input[]"></th>
                                        <th>名称</th>
                                        <th>图标</th>
                                        <th>目录</th>
                                        <th>状态</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <#assign  sql="select * from t_sys_menu a where 1=1 " />
                                <#if keyword?? && keyword!=''>
								<#assign sql=sql+" and a."+searchBy+" like '%"+keyword+"%'" />
								</#if>
								<#assign sql=sql+" order  by a.scort  "  />
                                <@my.pager id="pager" sql="${sql}"   page="${pageNo!1}"   size="${pageSize!10}"  />
                                 <#if pager.list?size !=0>
                                    <#list pager.list as dto>
                                        <tr  class="treegrid-${dto.id}  <#if (dto.pid)??>treegrid-parent-${dto.pid}</#if> ">
                                        <td>
                                            <input type="checkbox"   class="i-checkss" value="${dto.id}"   name="ids">
                                        </td>
                                        <td>${(dto.name)!}</td>
                                        <td><i class="fa  ${(dto.img)!}  text-navy"></i>    </td>
                                        <td>${(dto.channel)!}</td>
                                        <td> 
                                        <#if dto.state >
                                       <i class="fa fa-check text-navy"></i> 
                                        <#else>
                                        <i class="fa fa-close text-danger"></i> 
                                        </#if>
                                            
                                        </td>
                                    </tr>
                                    </#list>
                                 <#else>
                                                                               没数据
                                 </#if>
                                </tbody>
                            </table>
                            <#import "../pager.html" as p>
						    <@p.pager pager=pager baseUrl="op_list_${(OP.TMenu.id)!}.action?pageNo=:pageNo&pageSize=${pageSize!10}" />
                       </form>
                                
                    </div>
                </div>
                </div>
                

 